---
title: RTF document to PDF
summary: Render RTF text into a metafile and draw it across as many pages as needed.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-17
library: PdfAPI.SyncFusionCore
reference_type: package
operation_id: OP-SFC-005
trigger: Called by ConverterFactory for the rtf extension
---

# RTF document to PDF

Converts an RTF document stream to PDF bytes by rendering the RTF text as a metafile and drawing it across as many pages as the content requires.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-SFC-005 |
| **Trigger** | Called by [Execute a single conversion (converter template)](execute-single-conversion.md) via `RtfConverter.ConvertItem`, dispatched from [Convert a source document to PDF](convert-source-document-to-pdf.md) for `rtf` |
| **Inputs** | Source `Stream`, `ConvertRequest` |
| **Outputs** | PDF `byte[]` |
| **Primary components** | `RtfConverter.ConvertItem` |
| **Entry point** | `PdfApi.SyncFusionCore\Convert\RtfConverter.cs` |

## Steps

1. Choose conformance: `Pdf_A1B` when `IsPdfa`, otherwise `None`; create a `PdfDocument` with it ([BR-SFC-011](../business-rules.md#br-sfc-011-pdf%2Fa-conformance-level-a1b)).
2. Add one page and read its client bounds.
3. Read the whole stream as ASCII text (`StreamReader(stream, Encoding.ASCII)`) ([BR-SFC-012](../business-rules.md#br-sfc-012-ascii-only-source-text-reading)).
4. Convert the RTF text to a metafile with `PdfImage.FromRtf(text, bounds.Width, PdfImageType.Metafile)`.
5. Set `PdfMetafileLayoutFormat.SplitTextLines = true` so text flows across pages without a break,
   and draw the metafile at origin ([BR-SFC-013](../business-rules.md#br-sfc-013-rtf-text-flows-across-pages)).
6. Save to a `MemoryStream`, close the document, and return the bytes.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["ConvertItem called<br>with stream, request"]) --> Conf["Choose conformance<br>Pdf_A1B or None"]
	Conf --> Create["Create PdfDocument,<br>add one page"]
	Create --> Read[Read stream as ASCII text]
	Read --> Meta["Convert text to metafile<br>via PdfImage.FromRtf"]
	Meta --> SplitLines["Set SplitTextLines = true,<br>draw metafile at origin"]
	SplitLines --> Save["Save to MemoryStream,<br>close document"]
	Save --> Return([Return PDF bytes])
```

## Failure and edge-case behavior

- Any Syncfusion conversion failure surfaces as an exception, which is caught by
  [Execute a single conversion (converter template)](execute-single-conversion.md) and turned into a failed `PdfResult` rather than propagated here.
- Non-ASCII characters in the source RTF are not preserved because the stream is read with an
  ASCII `StreamReader`.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

## Sources
- `PdfApi.SyncFusionCore\Convert\RtfConverter.cs`
